﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BackupRestore.aspx.cs"
    Inherits="SalesManagement.Modules.System.BackupRestore" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script language="javascript" type="text/javascript">
        function DocumentReady() {
            MethodNamespace.DocumentReady();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager" runat="server" DirectMethodNamespace="MethodNamespace">
        <Listeners>
            <DocumentReady Handler="DocumentReady();" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store ID="storeMain" runat="server">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="FullFileName" />
                    <ext:RecordField Name="FileName" />
                    <ext:RecordField Name="FileSize" />
                    <ext:RecordField Name="CreatedDate" Type="Date" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <SortInfo Field="CreatedDate" Direction="DESC" />
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
        <Items>
            <ext:GridPanel ID="grdMain" runat="server" AutoExpandColumn="FullFileName" RowHeight="1"
                ColumnLines="true" BodyBorder="false" Border="false" StoreID="storeMain">
                <TopBar>
                    <ext:Toolbar ID="tbMain" runat="server">
                        <Items>
                            <ext:Button runat="server" ID="btnBackup" Icon="DatabaseCopy" Text="Sao lưu">
                                <DirectEvents>
                                    <Click OnEvent="btnBackup_Click" />
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column DataIndex="FileName" Header="Tên file" Width="250" />
                        <ext:Column ColumnID="FullFileName" DataIndex="FullFileName" Header="Tên đầy đủ" />
                        <ext:Column ColumnID="CreatedDate" DataIndex="CreatedDate" Header="Ngày tạo" />
                        <ext:Column DataIndex="FileSize" Header="Kích thước" />
                        <ext:CommandColumn Width="110">
                            <Commands>
                                <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="Phục hồi" />
                                <ext:GridCommand Icon="Delete" CommandName="Delete" Text="Xóa" />
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <DirectEvents>
                    <Command OnEvent="grdMain_OnCommand">
                        <ExtraParams>
                            <ext:Parameter Name="command" Value="command" Mode="Raw" />
                            <ext:Parameter Name="FullFileName" Value="record.data.FullFileName" Mode="Raw" />
                        </ExtraParams>
                        <Confirmation ConfirmRequest="true" Message="Bạn có thật sự muốn xóa dòng dữ liệu này không?"
                            Title="Thông báo" BeforeConfirm="if (command=='Edit') return false;" />
                    </Command>
                </DirectEvents>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
